﻿ using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace _42_Kicks
{
    class Soin : AniSprite
    {
        int TIMER = 9;
        public Rectangle collisionbis;
        int montantdesoin = 150;
        public bool Consommé = false;
        //Constructeurs de la classe Soin
        
        public Soin(float posx, float posy, int x, int y, int width, int height)
            : base(posx, posy, x, y, width, height)
        {
            width = 38; height = 31;
            collisionbis = new Rectangle(Convert.ToInt32(posx), Convert.ToInt32(posy), Convert.ToInt32(width), Convert.ToInt32(height)); }
        public Soin(Vector2 position, Rectangle source)
            : base(position, source)
        { }
        public virtual void LoadContent(ContentManager content)
        {
            texture = content.Load<Texture2D>("Soin");

        }

        public virtual void SOIGNE(Heros heros, GameTime gametime)
        {
            if (!Consommé)
            {
                if (heros.Collision(collisionbis))
                    if (heros.pointdevie + montantdesoin >= heros.PVMAX)
                    {
                        heros.pointdevie = heros.PVMAX;
                        TIMER -= gametime.ElapsedGameTime.Milliseconds;
                    }
                    else
                    {
                        heros.pointdevie += montantdesoin;
                        TIMER -= gametime.ElapsedGameTime.Milliseconds;
                    }
            }
            if (TIMER <= 0)
            { Consommé = true; }
        }

        

    }
}
